package kr.hkit.framework.dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.PreparedStatement;

public class CloseDaoUtil {
	public static void close(Connection connection){
		if(connection != null){
			try{
				connection.close();
			}catch(SQLException e){
				System.err.println(e);
			}finally{
				connection = null;
			}
		}
	}
	
	public static void close(PreparedStatement pstmt){
		if(pstmt != null){
			try {
				pstmt.close();
			} catch (SQLException e) {
				System.err.println(e);
			} finally{
				pstmt = null;
			}
		}
	}
	
	public static void close(ResultSet resultSet){
		if(resultSet != null){
			try {
				resultSet.close();
			} catch (SQLException e) {
				System.err.println(e);
			}finally{
				resultSet = null;
			}
		}
	}
	
	public static void close(ResultSet rs, PreparedStatement pstmt){
		close(rs);
		close(pstmt);
	}
}
